<!--
 * @Description: 重定向
 * @Author: ZY
 * @Date: 2021-01-05 18:01:18
 * @LastEditors: ycw
 * @LastEditTime: 2022-01-30 11:39:26
-->

<script lang="ts">
import { defineComponent } from 'vue'
import { useStore } from '@/store'
import router from '@/router'

export default defineComponent({

  created() {
    console.log(useStore().state.permission.routes)
    const routes=useStore().state.permission.routes;
    console.log(routes)
    if(routes[3].children.length>0){
     let filterRoutes= routes[3].children.filter(item=>!(item as any).hidden&&item.path.indexOf(':')==-1)
      console.log(filterRoutes[0].path)
      if(filterRoutes.length>0){
        router.push(routes[3].path+'/'+filterRoutes[0].path)
      }
      else{
        router.push(routes[3].path)
      }
    }
    
  },
  // eslint-disable-next-line vue/require-render-return
  render() {
    // Avoid warning for missing template
  }

})
</script>
